package com.synjones.wschool.face.serviceImpl;

import com.synjones.wschool.common.response.ResultBean;
import com.synjones.wschool.face.domain.Teacher;
import com.synjones.wschool.face.mapper.TeacherMapper;
import com.synjones.wschool.face.service.TeacherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * Created by 24398 on 2018/7/27.
 */
@Service
@Slf4j
public class TeacherServiceImpl implements TeacherService {
    @Resource
    private TeacherMapper teacherMapper;
    @Override
    public List<Teacher> listTeacherByIds(List<Long> teacherIds) {
        if(teacherIds == null || teacherIds.isEmpty()){
            return Collections.emptyList();
        }
        List<Teacher> teachers =  this.teacherMapper.findByTeacherIds(teacherIds);
        return teachers;
    }

    @Override
    public List<Teacher> listTeacherByEno(List<String> teacherEnos) {
        if(teacherEnos == null || teacherEnos.isEmpty()){
            return Collections.emptyList();
        }
        List<Teacher> teachers = this.teacherMapper.listTeacher(teacherEnos);
        return teachers;
    }

    @Override
    public Teacher fetchByEno(String userEno) {
        Teacher teacher = this.teacherMapper.selectOneByEno(userEno);
        return teacher;
    }
}
